package com.mdtx.utils;

import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 */
public class FastJsonUtil {

    public static <T> T json2Object(String json,Class<T> clazz){
        return JSON.parseObject(json,clazz);
    }

    public static String object2Json(Object obj){
        return JSON.toJSONString(obj);
    }

    public static void main(String[] args) {
        List<Map> list = new ArrayList<>();
        Map m = new HashMap();
        m.put("comment","测试");
        m.put("tableName","kh_jgxx");
        list.add(m);
        System.out.println(object2Json(list));
    }

}
